Skip to content

Conversation

Jack251970
Copy link
Member

@Jack251970 Jack251970 commented Jul 3, 2025

Follow on with #3791.

  • Make GetPluginsForInterface private.
  • Check plugin modified state for more lists and improve code quality.
  • Since ModifiedPlugins will possibly be accessed by multiple threads like updating many plugins concurrently, we need to change it to ConcurrentBag.

Copy link

gitstream-cm bot commented Jul 3, 2025

🥷 Code experts: no user but you matched threshold 10

Jack251970 has most 👩‍💻 activity in the files.
Jack251970 has most 🧠 knowledge in the files.

See details

Flow.Launcher.Core/Plugin/PluginManager.cs

Activity based on git-commit:

Jack251970
JUL 9 additions & 2 deletions
JUN 2 additions & 2 deletions
MAY 89 additions & 25 deletions
APR 73 additions & 68 deletions
MAR 42 additions & 37 deletions
FEB 276 additions & 198 deletions

Knowledge based on git-blame:
Jack251970: 34%

Flow.Launcher.Core/Resource/Internationalization.cs

Activity based on git-commit:

Jack251970
JUL
JUN
MAY 31 additions & 13 deletions
APR 34 additions & 30 deletions
MAR 67 additions & 40 deletions
FEB 5 additions & 4 deletions

Knowledge based on git-blame:
Jack251970: 44%

Flow.Launcher/ViewModel/MainViewModel.cs

Activity based on git-commit:

Jack251970
JUL
JUN 25 additions & 13 deletions
MAY 529 additions & 316 deletions
APR 35 additions & 28 deletions
MAR 695 additions & 628 deletions
FEB 63 additions & 21 deletions

Knowledge based on git-blame:
Jack251970: 41%

To learn more about /:\ gitStream - Visit our Docs

✨ Comment /gs review for LinearB AI review. Learn how to automate it here.

Copy link

gitstream-cm bot commented Jul 3, 2025

Be a legend 🏆 by adding a before and after screenshot of the changes you made, especially if they are around UI/UX.

@coderabbitai coderabbitai bot added bug Something isn't working enhancement New feature or request labels Jul 3, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refines how plugins are filtered by modified state and reorganizes the PluginManager internals for clarity.

  • Switch loops in MainViewModel and Internationalization to use filtered getters that exclude modified plugins
  • Refactor PluginManager to cache interface-specific plugin lists and replace _modifiedPlugins with ModifiedPlugins
  • Add GetResultUpdatePlugin and GetTranslationPlugins methods and initialize cached lists in LoadPlugins

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
Flow.Launcher/ViewModel/MainViewModel.cs Use GetResultUpdatePlugin() instead of unfiltered interface call
Flow.Launcher.Core/Resource/Internationalization.cs Replace GetPluginsForInterface<IPluginI18n>() with GetTranslationPlugins()
Flow.Launcher.Core/Plugin/PluginManager.cs Rename and relocate _modifiedPlugins, cache interface lists, add filtered getters
Comments suppressed due to low confidence (5)

Flow.Launcher.Core/Plugin/PluginManager.cs:40

  • [nitpick] Consider renaming _resultUpdatePlugin to _resultUpdatePlugins (plural) to reflect that it holds multiple plugin pairs and maintain consistency with other cached lists.
        private static IEnumerable<PluginPair> _resultUpdatePlugin;

Flow.Launcher.Core/Plugin/PluginManager.cs:36

  • [nitpick] The private field ModifiedPlugins uses PascalCase but most private fields in this codebase use a leading underscore (e.g., _modifiedPlugins). Consider renaming for consistency.
        private static readonly List<string> ModifiedPlugins = new();

Flow.Launcher.Core/Plugin/PluginManager.cs:422

  • [nitpick] The method GetResultUpdatePlugin returns multiple entries but uses a singular name. Consider renaming it to GetResultUpdatePlugins to clearly indicate it returns a collection.
        public static IList<PluginPair> GetResultUpdatePlugin()

Flow.Launcher.Core/Plugin/PluginManager.cs:427

  • Consider adding unit tests for GetTranslationPlugins and GetResultUpdatePlugin to verify that modified plugins are correctly excluded and that filtering behaves as expected.
        public static IList<PluginPair> GetTranslationPlugins()

Flow.Launcher.Core/Plugin/PluginManager.cs:185

  • Cached plugin lists are only initialized in LoadPlugins, but not in InitializePluginsAsync. If plugins are reloaded via InitializePluginsAsync, these caches may become stale. Ensure enumeration is updated in all initialization paths or revert to on-demand retrieval.
            _contextMenuPlugins = GetPluginsForInterface<IContextMenu>();

Copy link
Contributor

coderabbitai bot commented Jul 3, 2025

📝 Walkthrough

"""

Walkthrough

The changes refactor the plugin management system by centralizing and extending how plugin interface collections are handled in the PluginManager. New collections for plugins implementing specific interfaces are introduced, their initialization is reorganized, and new accessor methods are added. Code using these collections is updated to use the new accessors and to exclude modified plugins.

Changes

File(s) Change Summary
Flow.Launcher.Core/Plugin/PluginManager.cs Refactored plugin collections handling, added new collections and accessor methods, updated filtering logic, and reorganized initialization.
Flow.Launcher.Core/Resource/Internationalization.cs Replaced direct interface-based plugin retrieval with new accessor for translation plugins, added clarifying comment.
Flow.Launcher/ViewModel/MainViewModel.cs Updated result-updating plugin retrieval to use new accessor method.

Sequence Diagram(s)

sequenceDiagram
    participant App
    participant PluginManager
    participant PluginPair

    App->>PluginManager: LoadPlugins(settings)
    PluginManager->>PluginManager: Initialize plugin interface collections (_contextMenuPlugins, _homePlugins, _resultUpdatePlugin, _translationPlugins)
    PluginManager->>PluginPair: Filter out modified plugins
    App->>PluginManager: GetResultUpdatePlugin() / GetTranslationPlugins()
    PluginManager->>App: Return filtered plugin collections
Loading

Possibly related PRs

  • #3791: Modifies PluginManager to filter out modified plugins from plugin collections, directly related to plugin management changes.
  • #3115: Changes MainViewModel.RegisterResultsUpdatedEvent to use GetResultUpdatePlugin(), related to plugin event handling improvements.
  • #3399: Introduces the home plugin concept and modifies PluginManager's handling of home plugins, related to plugin collections management.

Suggested reviewers

  • jjw24
  • taooceros
    """
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
Flow.Launcher.Core/Plugin/PluginManager.cs (1)

298-298: Inconsistent usage of PluginModified methods.

There's an inconsistency in how plugin modification is checked:

  • Line 298: Uses PluginModified(p.Metadata.ID) (internal method)
  • Line 301: Uses API.PluginModified(plugin.Metadata.ID) (API method)

Based on the retrieved learnings, using the internal PluginModified() method is preferred for better performance and architectural design.

Apply this diff to use the internal method consistently:

-            if (API.PluginModified(plugin.Metadata.ID))
+            if (PluginModified(plugin.Metadata.ID))

Also applies to: 301-301

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b440aaa and d3f5274.

📒 Files selected for processing (3)
  • Flow.Launcher.Core/Plugin/PluginManager.cs (7 hunks)
  • Flow.Launcher.Core/Resource/Internationalization.cs (2 hunks)
  • Flow.Launcher/ViewModel/MainViewModel.cs (1 hunks)
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: Jack251970
PR: Flow-Launcher/Flow.Launcher#3791
File: Flow.Launcher.Core/Plugin/PluginManager.cs:293-295
Timestamp: 2025-07-01T05:46:13.251Z
Learning: In Flow.Launcher.Core/Plugin/PluginManager.cs, when checking if a plugin is modified within the PluginManager class itself, prefer using the internal static PluginModified(string id) method directly rather than going through API.PluginModified() for better performance and architectural design.
Flow.Launcher.Core/Resource/Internationalization.cs (2)
Learnt from: Jack251970
PR: Flow-Launcher/Flow.Launcher#3791
File: Flow.Launcher.Core/Plugin/PluginManager.cs:293-295
Timestamp: 2025-07-01T05:46:13.251Z
Learning: In Flow.Launcher.Core/Plugin/PluginManager.cs, when checking if a plugin is modified within the PluginManager class itself, prefer using the internal static PluginModified(string id) method directly rather than going through API.PluginModified() for better performance and architectural design.
Learnt from: taooceros
PR: Flow-Launcher/Flow.Launcher#2616
File: Flow.Launcher/Flow.Launcher.csproj:7-7
Timestamp: 2024-10-08T15:52:58.573Z
Learning: In the Flow Launcher project, the version number in the `Flow.Launcher.csproj` file is dynamically updated during the CI/CD process.
Flow.Launcher/ViewModel/MainViewModel.cs (2)
Learnt from: Jack251970
PR: Flow-Launcher/Flow.Launcher#3791
File: Flow.Launcher.Core/Plugin/PluginManager.cs:293-295
Timestamp: 2025-07-01T05:46:13.251Z
Learning: In Flow.Launcher.Core/Plugin/PluginManager.cs, when checking if a plugin is modified within the PluginManager class itself, prefer using the internal static PluginModified(string id) method directly rather than going through API.PluginModified() for better performance and architectural design.
Learnt from: taooceros
PR: Flow-Launcher/Flow.Launcher#3112
File: Flow.Launcher/ViewModel/ResultsViewModel.cs:231-239
Timestamp: 2024-12-07T18:48:14.625Z
Learning: Optimizing the LINQ operations in the method `NewResults` in `ResultsViewModel.cs` did not improve performance.
Flow.Launcher.Core/Plugin/PluginManager.cs (2)
Learnt from: Jack251970
PR: Flow-Launcher/Flow.Launcher#3791
File: Flow.Launcher.Core/Plugin/PluginManager.cs:293-295
Timestamp: 2025-07-01T05:46:13.251Z
Learning: In Flow.Launcher.Core/Plugin/PluginManager.cs, when checking if a plugin is modified within the PluginManager class itself, prefer using the internal static PluginModified(string id) method directly rather than going through API.PluginModified() for better performance and architectural design.
Learnt from: jjw24
PR: Flow-Launcher/Flow.Launcher#2448
File: Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs:16-20
Timestamp: 2025-01-18T10:10:18.414Z
Learning: In Flow Launcher's plugin system, the PluginInitContext parameter passed to plugin constructors is guaranteed to be non-null by the plugin initialization system, making null checks unnecessary.
🧬 Code Graph Analysis (2)
Flow.Launcher.Core/Resource/Internationalization.cs (1)
Flow.Launcher.Core/Plugin/PluginManager.cs (2)
  • PluginManager (23-729)
  • PluginManager (162-168)
Flow.Launcher.Core/Plugin/PluginManager.cs (4)
Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs (5)
  • List (177-177)
  • List (445-445)
  • T (319-319)
  • PluginModified (539-539)
  • InstallPlugin (561-561)
Flow.Launcher.Core/Plugin/PluginsLoader.cs (5)
  • List (25-56)
  • IEnumerable (58-137)
  • IEnumerable (139-151)
  • IEnumerable (153-165)
  • PluginsLoader (17-166)
Flow.Launcher.Infrastructure/UserSettings/PluginSettings.cs (4)
  • UpdatePluginSettings (41-90)
  • Plugin (92-99)
  • Plugin (101-105)
  • Plugin (108-134)
Flow.Launcher.Plugin/PluginMetadata.cs (1)
  • PluginMetadata (10-163)
🪛 GitHub Check: Check Spelling
Flow.Launcher.Core/Plugin/PluginManager.cs

[warning] 182-182:
metadatas is not a recognized word. (unrecognized-spelling)


[warning] 180-180:
metadatas is not a recognized word. (unrecognized-spelling)


[warning] 179-179:
metadatas is not a recognized word. (unrecognized-spelling)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: build
🔇 Additional comments (12)
Flow.Launcher.Core/Resource/Internationalization.cs (3)

77-77: Excellent refactoring to use centralized plugin management.

The change from GetPluginsForInterface<IPluginI18n>() to GetTranslationPlugins() aligns perfectly with the PR objectives of extending plugin modified state checking. The new method automatically filters out modified plugins, improving code quality and consistency.


281-281: Good documentation improvement.

The added comment clearly explains the purpose of the loop, enhancing code readability and maintainability.


282-282: Consistent application of the new plugin management approach.

This change mirrors the improvement at line 77, ensuring consistent use of the centralized GetTranslationPlugins() method throughout the internationalization class.

Flow.Launcher/ViewModel/MainViewModel.cs (1)

263-263: Proper implementation of centralized plugin management for result updates.

The change from GetPluginsForInterface<IResultUpdated>() to GetResultUpdatePlugin() successfully extends the plugin modified state checking to the result update functionality, directly addressing the PR objectives. This ensures modified plugins are excluded from result update events.

Flow.Launcher.Core/Plugin/PluginManager.cs (8)

36-36: Good refactoring: Improved accessibility and naming consistency.

The rename from _modifiedPlugins to ModifiedPlugins and changing from private to readonly improves consistency with other public collections in the class like AllPlugins and GlobalPlugins.


38-41: Well-structured addition of plugin interface collections.

The new private static fields for _resultUpdatePlugin and _translationPlugins follow the established pattern of the existing _contextMenuPlugins and _homePlugins collections. This centralization will improve performance by avoiding repeated interface filtering operations.


177-189: Excellent code organization improvement.

The changes to LoadPlugins method improve code quality by:

  1. Storing metadatas in a local variable for better readability
  2. Centralizing plugin collection initialization after all plugins are loaded
  3. Using the generic GetPluginsForInterface<T>() method consistently

This ensures all interface collections are properly initialized and available for the new filtering methods.


416-420: Good encapsulation by making the method private.

Making GetPluginsForInterface<T>() private is appropriate since it's now used internally for initialization, and the new public methods provide the proper filtered access.


422-430: Excellent addition of filtered plugin accessor methods.

The new GetResultUpdatePlugin() and GetTranslationPlugins() methods provide clean, filtered access to plugin collections while excluding modified plugins. This approach is consistent with the existing ValidPluginsForHomeQuery() method and aligns with the PR's objective of extending modified state checking.


435-435: Improved plugin filtering consistency.

The update to filter out modified plugins in GetContextMenusForPlugin() is excellent and aligns with the PR's objective. The use of the direct PluginModified() method is also consistent with the architectural preference noted in the retrieved learnings.


463-463: Consistent application of modified plugin filtering.

The filtering logic in IsHomePlugin() correctly excludes modified plugins, maintaining consistency with other plugin collection methods in the class.


561-561: Consistent field rename implementation.

All references to the renamed ModifiedPlugins field have been properly updated throughout the class, maintaining consistency and correctness.

Also applies to: 568-568, 655-655, 724-724

@Jack251970 Jack251970 requested a review from jjw24 July 3, 2025 12:56
@Jack251970 Jack251970 removed the enhancement New feature or request label Jul 3, 2025
@Jack251970 Jack251970 added this to the 2.0.0 milestone Jul 3, 2025
@coderabbitai coderabbitai bot added the enhancement New feature or request label Jul 3, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🔭 Outside diff range comments (1)
Flow.Launcher.Core/Plugin/PluginManager.cs (1)

297-303: Use internal PluginModified instead of API.PluginModified

Per prior guidance (PR #3791), when inside PluginManager prefer the internal static PluginModified(id) helper for performance and decoupling. Replace the external API call here.

-if (API.PluginModified(plugin.Metadata.ID))
+if (PluginModified(plugin.Metadata.ID))
♻️ Duplicate comments (2)
Flow.Launcher.Core/Plugin/PluginManager.cs (2)

427-430: Same comments as above apply to GetTranslationPlugins – plural naming and potential caching of ToList() result.


561-569: Duplicate additions to ModifiedPlugins

ModifiedPlugins.Add(id) is called in three different code paths. With ConcurrentBag this can add the same ID many times, inflating memory and slowing .Contains. Switching to the set-style structure suggested earlier removes that concern.

Also applies to: 655-657, 724-725

🧹 Nitpick comments (2)
Flow.Launcher.Core/Plugin/PluginManager.cs (2)

38-41: Plural-naming nitpick

_resultUpdatePlugin should be _resultUpdatePlugins (plural) for consistency with the other collections and to avoid cognitive friction.


422-425: Method name & return type

  1. Method should be plural: GetResultUpdatePlugins() to match its siblings.
  2. You rebuild the list on every call (ToList()). If the modified-filter doesn’t change often, cache the list or return IEnumerable to avoid allocations.
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d3f5274 and 446c61f.

📒 Files selected for processing (1)
  • Flow.Launcher.Core/Plugin/PluginManager.cs (7 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: Jack251970
PR: Flow-Launcher/Flow.Launcher#3791
File: Flow.Launcher.Core/Plugin/PluginManager.cs:293-295
Timestamp: 2025-07-01T05:46:13.251Z
Learning: In Flow.Launcher.Core/Plugin/PluginManager.cs, when checking if a plugin is modified within the PluginManager class itself, prefer using the internal static PluginModified(string id) method directly rather than going through API.PluginModified() for better performance and architectural design.
Flow.Launcher.Core/Plugin/PluginManager.cs (2)
Learnt from: Jack251970
PR: Flow-Launcher/Flow.Launcher#3791
File: Flow.Launcher.Core/Plugin/PluginManager.cs:293-295
Timestamp: 2025-07-01T05:46:13.251Z
Learning: In Flow.Launcher.Core/Plugin/PluginManager.cs, when checking if a plugin is modified within the PluginManager class itself, prefer using the internal static PluginModified(string id) method directly rather than going through API.PluginModified() for better performance and architectural design.
Learnt from: jjw24
PR: Flow-Launcher/Flow.Launcher#2448
File: Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs:16-20
Timestamp: 2025-01-18T10:10:18.414Z
Learning: In Flow Launcher's plugin system, the PluginInitContext parameter passed to plugin constructors is guaranteed to be non-null by the plugin initialization system, making null checks unnecessary.
🪛 GitHub Check: Check Spelling
Flow.Launcher.Core/Plugin/PluginManager.cs

[warning] 182-182:
metadatas is not a recognized word. (unrecognized-spelling)


[warning] 180-180:
metadatas is not a recognized word. (unrecognized-spelling)


[warning] 179-179:
metadatas is not a recognized word. (unrecognized-spelling)

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: gitStream.cm
  • GitHub Check: build
🔇 Additional comments (1)
Flow.Launcher.Core/Plugin/PluginManager.cs (1)

185-188: Order-of-initialisation subtlety

These interface-specific collections are initialised in LoadPlugins. Ensure that every public method that touches them (e.g. ValidPluginsForHomeQuery, GetContextMenusForPlugin, etc.) is guaranteed not to be called before LoadPlugins has finished; otherwise NullReferenceException will surface.
If that guarantee doesn’t already exist, guard the fields or move the initialisation into the static ctor.

@Jack251970 Jack251970 removed the enhancement New feature or request label Jul 3, 2025
@jjw24
Copy link
Member

jjw24 commented Jul 5, 2025

@coderabbitai full review

Copy link
Contributor

coderabbitai bot commented Jul 5, 2025

✅ Actions performed

Full review triggered.

@coderabbitai coderabbitai bot added the enhancement New feature or request label Jul 5, 2025
@jjw24
Copy link
Member

jjw24 commented Jul 6, 2025

@coderabbitai full review

Copy link
Contributor

coderabbitai bot commented Jul 6, 2025

✅ Actions performed

Full review triggered.

@Jack251970
Copy link
Member Author

@coderabbitai full review

Copy link
Contributor

coderabbitai bot commented Jul 6, 2025

✅ Actions performed

Full review triggered.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

♻️ Duplicate comments (1)
Flow.Launcher.Core/Plugin/PluginManager.cs (1)

35-36: Thread-safe collection adopted as discussed.

The change to ConcurrentBag<string> addresses the concurrent access issue mentioned in the PR objectives.

🧹 Nitpick comments (2)
Flow.Launcher/ViewModel/MainViewModel.cs (1)

276-276: Consider renaming to GetResultUpdatePlugins() for consistency.

The method returns an IList<PluginPair> (a collection) but has a singular name. This is inconsistent with GetTranslationPlugins() which correctly uses plural form.

Flow.Launcher.Core/Plugin/PluginManager.cs (1)

298-298: Consider future optimization for modified plugin lookups.

The current implementation performs O(n) lookups in ConcurrentBag for each PluginModified check. While acceptable for typical usage (few modified plugins), consider using ConcurrentDictionary<string, byte> if performance becomes an issue with many concurrent plugin updates.

Also applies to: 314-314, 424-424, 429-429, 435-435, 463-463

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8e6eaf7 and c33f72d.

📒 Files selected for processing (3)
  • Flow.Launcher.Core/Plugin/PluginManager.cs (7 hunks)
  • Flow.Launcher.Core/Resource/Internationalization.cs (2 hunks)
  • Flow.Launcher/ViewModel/MainViewModel.cs (1 hunks)
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: Jack251970
PR: Flow-Launcher/Flow.Launcher#3791
File: Flow.Launcher.Core/Plugin/PluginManager.cs:293-295
Timestamp: 2025-07-01T05:46:13.251Z
Learning: In Flow.Launcher.Core/Plugin/PluginManager.cs, when checking if a plugin is modified within the PluginManager class itself, prefer using the internal static PluginModified(string id) method directly rather than going through API.PluginModified() for better performance and architectural design.
Flow.Launcher.Core/Resource/Internationalization.cs (2)
Learnt from: Jack251970
PR: Flow-Launcher/Flow.Launcher#3791
File: Flow.Launcher.Core/Plugin/PluginManager.cs:293-295
Timestamp: 2025-07-01T05:46:13.251Z
Learning: In Flow.Launcher.Core/Plugin/PluginManager.cs, when checking if a plugin is modified within the PluginManager class itself, prefer using the internal static PluginModified(string id) method directly rather than going through API.PluginModified() for better performance and architectural design.
Learnt from: taooceros
PR: Flow-Launcher/Flow.Launcher#2616
File: Flow.Launcher/Flow.Launcher.csproj:7-7
Timestamp: 2024-10-08T15:52:58.573Z
Learning: In the Flow Launcher project, the version number in the `Flow.Launcher.csproj` file is dynamically updated during the CI/CD process.
Flow.Launcher/ViewModel/MainViewModel.cs (1)
Learnt from: Jack251970
PR: Flow-Launcher/Flow.Launcher#3791
File: Flow.Launcher.Core/Plugin/PluginManager.cs:293-295
Timestamp: 2025-07-01T05:46:13.251Z
Learning: In Flow.Launcher.Core/Plugin/PluginManager.cs, when checking if a plugin is modified within the PluginManager class itself, prefer using the internal static PluginModified(string id) method directly rather than going through API.PluginModified() for better performance and architectural design.
Flow.Launcher.Core/Plugin/PluginManager.cs (4)
Learnt from: Jack251970
PR: Flow-Launcher/Flow.Launcher#3791
File: Flow.Launcher.Core/Plugin/PluginManager.cs:293-295
Timestamp: 2025-07-01T05:46:13.251Z
Learning: In Flow.Launcher.Core/Plugin/PluginManager.cs, when checking if a plugin is modified within the PluginManager class itself, prefer using the internal static PluginModified(string id) method directly rather than going through API.PluginModified() for better performance and architectural design.
Learnt from: jjw24
PR: Flow-Launcher/Flow.Launcher#2448
File: Plugins/Flow.Launcher.Plugin.Sys/ThemeSelector.cs:16-20
Timestamp: 2025-01-18T10:10:18.414Z
Learning: In Flow Launcher's plugin system, the PluginInitContext parameter passed to plugin constructors is guaranteed to be non-null by the plugin initialization system, making null checks unnecessary.
Learnt from: Jack251970
PR: Flow-Launcher/Flow.Launcher#3500
File: Flow.Launcher/Storage/TopMostRecord.cs:145-149
Timestamp: 2025-05-01T05:38:25.673Z
Learning: For the MultipleTopMostRecord implementation in Flow.Launcher, sequence order of records in the ConcurrentBag does not need to be preserved, as confirmed by the developer. The unordered nature of ConcurrentBag is acceptable for this implementation.
Learnt from: Jack251970
PR: Flow-Launcher/Flow.Launcher#3500
File: Flow.Launcher/Storage/TopMostRecord.cs:191-197
Timestamp: 2025-05-01T05:35:21.852Z
Learning: ConcurrentBag.TryTake(out T) in C# removes an arbitrary item from the bag, not necessarily the one matching the out parameter. This can lead to removing the wrong element when trying to remove a specific item. A safer approach is to reconstruct the collection using filtering or use an ordered collection with proper removal methods.
🪛 GitHub Check: Check Spelling
Flow.Launcher.Core/Plugin/PluginManager.cs

[warning] 182-182:
metadatas is not a recognized word. (unrecognized-spelling)


[warning] 180-180:
metadatas is not a recognized word. (unrecognized-spelling)


[warning] 179-179:
metadatas is not a recognized word. (unrecognized-spelling)

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: gitStream.cm
  • GitHub Check: build
🔇 Additional comments (3)
Flow.Launcher.Core/Resource/Internationalization.cs (1)

77-77: LGTM!

The changes correctly use the new GetTranslationPlugins() method instead of the now-private GetPluginsForInterface<IPluginI18n>(). The added comment improves code clarity.

Also applies to: 281-282

Flow.Launcher.Core/Plugin/PluginManager.cs (2)

38-42: Well-structured initialization of plugin interface collections.

The collections are properly initialized after all plugins are loaded, ensuring complete interface discovery. The null-coalescing operator in GetPluginsForInterface (line 419) provides safety if accessed before initialization.

Also applies to: 184-188


422-430: Correct implementation of filtered plugin accessors.

Both methods properly filter out modified plugins before returning the collections, maintaining consistency with the existing plugin management design.

@Jack251970 Jack251970 merged commit 4fcc12d into dev Jul 6, 2025
6 checks passed
@Jack251970 Jack251970 deleted the check_plugin_modified branch July 6, 2025 12:01
@jjw24 jjw24 removed enhancement New feature or request 1 min review labels Jul 6, 2025
TBM13 pushed a commit to TBM13/Flow.Launcher that referenced this pull request Jul 8, 2025
…_modified

Check plugin modified state for more lists and improve code quality
@jjw24 jjw24 modified the milestones: 2.0.0, 1.20.2 Jul 13, 2025
jjw24 pushed a commit that referenced this pull request Jul 13, 2025
Check plugin modified state for more lists and improve code quality
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants